package com.ayz.gateway.center.infrastructure.notify;

import com.ayz.gateway.center.domain.repository.IGatewayServiceRepository;
import com.ayz.gateway.common.constants.GatewayServiceData;
import com.ayz.gateway.common.notify.ApplicationEvent;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @ClassName GatewayServiceChangeEvent
 * @Description TODO: 网关服务变更事件
 * 网关服务注册 和 网关服务注销两个行为都会触发此事件
 * @Author 快乐的星球
 * @Date 2023/6/12 11:07
 * @Version 1.0
 **/
public class GatewayServiceChangeEvent extends ApplicationEvent {
    public GatewayServiceChangeEvent(GatewayServiceMetadata metadata) {
        super(metadata);
    }

    @Getter
    @Setter
    @AllArgsConstructor
    @NoArgsConstructor
    public static class GatewayServiceMetadata{
        /**
         * 网关服务是注册还是注销
         * true:注册
         * false:注销
         */
        private boolean registry;
        /**
         * 该网关服务的基础信息
         */
        private GatewayServiceData gatewayServiceData;

        /**
         * 网关服务存储仓库
         */
        private IGatewayServiceRepository gatewayServiceRepository;
    }
}
